{*
Update logs
10/02/2010      immanuel192         Remove javascript auto image loader because it take long times for page loading
*}
<link rel="stylesheet" type="text/css" href="{$smarty.const.THEME_RELATIVE}modules/imagegallerymodule/imagemodule.css" />
<link rel="stylesheet" type="text/css" href="{$smarty.const.URL_FULL}js/lytebox3.25/lytebox.css">
<script type="text/javascript" src="{$smarty.const.URL_FULL}js/lytebox3.25/lytebox.js"></script>

{* Override css for super box*} 
{literal}
<style type="text/css">
	#superbox{
		background: transparent;
	}
	#superbox p.nextprev{
		display: none !important;
	}
</style>
{/literal}
{* end Override css*} 

{permissions level=$smarty.const.UILEVEL_PERMISSIONS}
{if $permissions.administrate == 1}
	<a href="{link action=userperms _common=1}"><img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}userperms.png" title="{$_TR.alt_userperm}" alt="{$_TR.alt_userperm}" /></a>
	<a href="{link action=groupperms _common=1}"><img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}groupperms.png" title="{$_TR.alt_groupperm}" alt="{$_TR.alt_groupperm}" /></a>
{/if}
{/permissions}
{permissions level=$smarty.const.UILEVEL_NORMAL}
{if $permissions.configure == 1}
			<a href="{link action=configure _common=1}"><img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}configure.png" title="{$_TR.alt_configure}" alt="{$_TR.alt_configure}" /></a>
{/if}
{if $permissions.configure == 1 or $permissions.administrate == 1}
	<br />
{/if}
{/permissions}

{if $moduletitle !=""}
<div id="AlbumName" class="div-title-album-moi" >             
	{$moduletitle}
</div>{/if}
{*End of module title*}

<div class="imagemodule">
{* gallery info here *}
	<div class="gallery" >
			<div class="gallery_box">
				<div class="gallery_image" {if $gallery->image_path !=""}style="background: url({$smarty.const.PATH_RELATIVE}phpThumb.php?src={$gallery->image_path}&h=140);" {/if}></div>
			</div>
			<div class="gallery_info">
				<div align=center>
					<span style="font-weight: bold;">{$gallery->image_count}</span> {$_TR.images}
					<a href="{link module=imagegallerymodule action=slideshow id=$gallery->id ajax_action=1}" target=_blank alt="Slideshow" title="Slideshow"><img src="{$smarty.const.THEME_RELATIVE}modules/imagegallerymodule/images/icon_slide.png" border=1></a>
				</div>
			</div>
	</div>
	<div style="width: 98%; padding-left: 5px; padding-top: 5px;">
		{permissions level=$smarty.const.UILEVEL_PERMISSIONS}
			<div class="itemactions">
					   {if $permissions.configure == 1 or $permissions.administrate == 1}
					   {if $permissions.edit == 1}
							 <a class="mngmntlink imagegallery_mngmntlink" href="{link action=edit_gallery id=$gallery->id}">
								<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}edit.png" title="{$_TR.alt_edit}" alt="{$_TR.alt_edit}" />
							 </a>
						{/if}
						{if $permissions.delete == 1}
							 <a class="mngmntlink imagegallery_mngmntlink" href="{link action=delete_gallery id=$gallery->id}">
								<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}delete.png" title="{$_TR.alt_delete}" alt="{$_TR.alt_delete}" />
						   </a>
						{/if}
				   {/if}
			</div>
			{/permissions}
		<span style="font-weight: bold; font-size: 150%; color: #808080;" class="image_gallery_name">{$gallery->name}</span>
		{$gallery->description }
	</div>
	<div class="clear">
	</div>  
{* end of gallery info * }


{* all images here *}
	{foreach name=a from=$gallery->images item=image}
	  <div class="float-left image">
		{permissions level=$smarty.const.UI_LEVEL_NORMAL}
		  <p>
				  {if $permissions.manage == 1}
				  {if $smarty.foreach.a.first == false}
				  {math equation="x-1" x=$image->rank assign=prevrank}
					 <a class="mngmntlink imagegallery_mngmntlink" href="{link action=order_images gid=$gallery->id a=$image->rank b=$prevrank}"><img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}left.png" title="{$_TR.alt_previous}" alt="{$_TR.alt_previous}" /></a>
				{/if}
					<a class="mngmntlink imagegallery_mngmntlink" href="{link action=edit_image id=$image->id}"><img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}edit.png" title="{$_TR.alt_edit}" alt="{$_TR.alt_edit}" /></a>
					<a class="mngmntlink imagegallery_mngmntlink" href="{link action=delete_image id=$image->id}" onclick="return confirm('Are you sure you want to delete this image?');"><img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}delete.png" title="{$_TR.alt_delete}" alt="{$_TR.alt_delete}" /></a>
				  {if $smarty.foreach.a.last == false}
					{math equation="x+1" x=$image->rank assign=nextrank}
					<a class="mngmntlink imagegallery_mngmntlink" href="{link action=order_images gid=$gallery->id a=$image->rank b=$nextrank}"><img class="mngmnt_icon" style="border:none; text-align:center; margin-right: 5px;" src="{$smarty.const.ICON_RELATIVE}right.png" title="{$_TR.next}" alt="{$_TR.next}" /></a>
				  {/if}
				{/if}
				{/permissions}
		{*
		10/02/2010 - immanuel192 - save original image path
		{$smarty.const.URL_BASE}/{$image->file->directory}/{$image->file->filename}
		*}
		<a href="{$smarty.const.PATH_RELATIVE}phpThumb.php?src={$image->file->directory}/{$image->file->filename}&w=800" id="image_{$image->id}" title="{$image->name}" class="imagegallery_image  " rel="superbox[gallery][my_gallery]">
			<img src="{$smarty.const.PATH_RELATIVE}phpThumb.php?src={$image->file->directory}/{$image->file->filename}&w=152" border=0 title="{$image->alt}" alt="{$image->alt}">
		</a>
		<p>{$image->name}<p> 
	  </div>
	{if ($smarty.foreach.a.index+1) % $gallery->perrow == 0}
	  <div class="clear">
	  </div>
	{/if}
	{foreachelse}
	  <div align="center"><i>No Galleries Found</i></div>
	{/foreach}
	{* end of all images * }
   <div class="clear">                     
   </div>
{*End of gallery images*} 
</div>

<div class="clear"></div>

<div align=center>{paging current_page=$page pages=$page_count action=view_gallery id=$gallery->id module=imagegallerymodule page_length=4 src=$__loc->src}</div>

{permissions level=$smarty.const.UILEVEL_NORMAL}
		{if $permissions.manage == 1}
			<script type="text/javascript">
			{literal}
			function validate(frm) {
					var num = parseInt(frm.count.value);

					if (num <= 0 || isNaN(num)) {
							alert("Please enter only positive, whole numbers.");
							return false;
					}

					if (num > 25) num = 25;

					frm.count.value = num;
					return true;
			}
			{/literal}
			</script>
			<form method="get" onsubmit="return validate(this)" action="{$smarty.const.URL_FULL}index.php">
			<input type="hidden" name="module" value="imagegallerymodule" />
			<input type="hidden" name="src" value="{$__loc->src}" />
			<input type="hidden" name="gid" value="{$gallery->id}" />
			<input type="hidden" name="action" value="upload_multiple" />
			Upload Multiple files to {$gallery->name}: <input type="text" size="3" name="count" value="3" /><input type="submit" value="Upload" />
			</form>
		{/if}
		{/permissions}

{* Preload image *}
<script language="javascript">
{literal}
jQuery(document).ready(function(){{/literal}
	$.superbox();
	{foreach name=a from=$gallery->images item=image}
		image{$image->id}= new Image();
		image{$image->id}.src="{$smarty.const.PATH_RELATIVE}phpThumb.php?src={$image->file->directory}/{$image->file->filename}&w=800";
	{/foreach}
{literal}});{/literal}
</script>
{* End of Preload image *}
{permissions level=$smarty.const.UILEVEL_NORMAL}
{if $permissions.edit == 1}
	<a class="mngmntlink imagegallery_mngmntlink" href="{link action=edit_gallery}">
		<img src="{$smarty.const.ICON_RELATIVE}mimetypes/image.png" /> New Gallery
	</a>
{/if}
{/permissions}
